var nike = nike || {};
nike.cq = nike.cq || {};
nike.cq.NikeCom = nike.cq.NikeCom || {};
nike.cq.NikeCom.reload = function () {
    nike.cq.NikeCom.leftNavigation.initLeftNavMod();
    nike.cq.NikeCom.TeamSelector.init();
    nike.cq.PES.ProductDrawer.init();
    nike.cq.PES.PesCarousel.init();
    nike.cq.PES.p1Layout.init();
    nike.cq.PES.p1Toggle.init();
    nike.cq.PES.ContentGrid.init();
    nike.cq.PES.Notification.init()
};
var nike = nike || {};
nike.cq = nike.cq || {};
nike.cq.NikeCom = nike.cq.NikeCom || {};
nike.cq.NikeCom.SocialFeedReader = (function () {
    var E = function (R, S) {
        return $("<a>", {
            href: R,
            "class": "nike-cq-community-modal-link",
            target: S ? S : "_blank"
        })
    };
    var N = function (S, R) {
        var T = $("<div>", {
            "data-player-id": "1684488591001",
            "data-video-id": "" + R,
            "data-player-type": "brightcove",
            "data-width": "620",
            "data-height": "349",
            "data-auto-start": "true"
        });
        T.videoPlayer = new nike.cq.UI.Component.VideoPlayer(T);
        return T
    };
    var I = function (U, T, R) {
        var T = T || "100%";
        var R = R || "349";
        var S = $("<div>", {
            "data-video-id": "" + U,
            "data-player-type": "youtube",
            "data-width": T,
            "data-height": R,
            "data-auto-start": "true"
        });
        S.videoPlayer = new nike.cq.UI.Component.VideoPlayer(S);
        return S
    };

    function O(S) {
        var T = /(?:https?:\/{2})?(?:w{3}\.)?youtu(?:be)?\.(?:com|be)(?:\/watch\?(?:feature=[^\s]+&)?v=|\/)([^\s&]+)/i;
        var R = S.match(T);
        if (R && R[1].length == 11) {
            return R[1]
        } else {
            return ""
        }
    }
    var D = function (T, S) {
        var R = $("<img/>", {
            "class": "nike-cq-community-modal-image",
            src: "/etc/designs/nike/images/general/spacer.gif",
            css: {
                background: "url(" + T + ") no-repeat center center"
            }
        });
        if (S) {
            var U = E(S);
            U.append(R);
            return U
        }
        return R
    };
    var M = "nike-cq-community-modal-text-only",
        K = "nike-cq-community-modal-full-size",
        C = "nike-cq-community-modal-brightcove",
        Q = "nike-cq-community-modal-youtube";
    var J = function (S) {
        var R = null;
        return {
            getTitle: function () {
                return S.title
            },
            getText: function () {
                return S.text
            },
            getNetwork: function () {
                return S.network
            },
            getPostDate: function () {
                return S.postDate
            },
            getSizeClass: function () {
                return S.image === "" ? M : K
            },
            getImage: function () {
                return S.image
            },
            getLink: function () {
                return S.link
            },
            getRightElement: function () {
                if (S.mediaType === "video") {
                    var T = $("<div>", {
                        "class": "nike-cq-social-feed-community-content-right"
                    });
                    var U = O(S.image);
                    R = I(U, "100%", "100%");
                    T.append(R);
                    return T
                } else {
                    if (S.image === "") {
                        return null
                    } else {
                        var T = $("<div>", {
                            "class": "nike-cq-social-feed-community-content-right"
                        });
                        T.append(D(S.image, S.link));
                        return T
                    }
                }
            },
            cleanUp: function () {
                if (R) {
                    R.remove()
                }
            }
        }
    };
    var F = function (R) {
        return {
            getTitle: function () {
                return R.title
            },
            getText: function () {
                return R.text
            },
            getNetwork: function () {
                return R.network
            },
            getPostDate: function () {
                return R.postDate
            },
            getSizeClass: function () {
                return R.image === "" ? M : K
            },
            getLink: function () {
                return R.link
            },
            getRightElement: function () {
                if (R.image === "") {
                    return null
                } else {
                    var S = $("<div>", {
                        "class": "nike-cq-social-feed-community-content-right"
                    });
                    S.append(D(R.image, R.link));
                    return S
                }
            }
        }
    };
    var A = function (R) {
        return {
            getTitle: function () {
                return R.title
            },
            getText: function () {
                return R.text
            },
            getNetwork: function () {
                return R.network
            },
            getPostDate: function () {
                return R.postDate
            },
            getSizeClass: function () {
                return K
            },
            getLink: function () {
                return R.link
            },
            getRightElement: function () {
                var S = $("<div>", {
                    "class": "nike-cq-social-feed-community-content-right"
                });
                S.append(D(R.image, R.link));
                return S
            }
        }
    };
    var L = function (S) {
        var R;
        return {
            getTitle: function () {
                return S.title
            },
            getText: function () {
                return S.text
            },
            getNetwork: function () {
                return S.network
            },
            getPostDate: function () {
                return S.postDate
            },
            getSizeClass: function () {
                return C
            },
            getRightElement: function () {
                var T = $("<div>", {
                    "class": "nike-cq-social-feed-community-content-right"
                });
                R = N(S.image, S.link);
                T.append(R);
                return T
            },
            cleanUp: function () {
                if (R) {
                    R.remove()
                }
            }
        }
    };
    var H = function (S) {
        var R;
        return {
            getTitle: function () {
                return S.title
            },
            getText: function () {
                return S.text
            },
            getNetwork: function () {
                return S.network
            },
            getPostDate: function () {
                return S.postDate
            },
            getSizeClass: function () {
                return Q
            },
            getRightElement: function () {
                var T = $("<div>", {
                    "class": "nike-cq-social-feed-community-content-right"
                });
                var U = O(S.link);
                R = I(U);
                T.append(R);
                return T
            },
            cleanUp: function () {
                if (R) {
                    R.remove()
                }
            }
        }
    };
    var G = function (R) {
        return {
            getTitle: function () {
                return R.title
            },
            getText: function () {
                return R.text
            },
            getNetwork: function () {
                return R.network
            },
            getPostDate: function () {
                return R.postDate
            },
            getSizeClass: function () {
                return R.image === "" ? M : K
            },
            getImage: function () {
                return R.image
            },
            getLink: function () {
                return R.link
            },
            getRightElement: function () {
                if (R.image === "") {
                    return null
                } else {
                    var S = $("<div>", {
                        "class": "nike-cq-social-feed-community-content-right"
                    });
                    S.append(D(R.image, R.link));
                    return S
                }
            }
        }
    };
    var P = function (R) {
        return {
            getTitle: function () {
                return R.title
            },
            getText: function () {
                return R.text
            },
            getNetwork: function () {
                return R.network
            },
            getPostDate: function () {
                return R.postDate
            },
            getSizeClass: function () {
                return R.image === "" ? M : K
            },
            getImage: function () {
                return R.image
            },
            getLink: function () {
                return R.link
            },
            getRightElement: function () {
                if (R.image === "") {
                    return null
                } else {
                    var S = $("<div>", {
                        "class": "nike-cq-social-feed-community-content-right"
                    });
                    S.append(D(R.image, R.link));
                    return S
                }
            }
        }
    };
    var B = function (R) {
        return {
            getTitle: function () {
                return R.title
            },
            getText: function () {
                return R.text
            },
            getNetwork: function () {
                return R.network
            },
            getPostDate: function () {
                return R.postDate
            },
            getSizeClass: function () {
                return R.image === "" ? M : K
            },
            getImage: function () {
                return R.image
            },
            getLink: function () {
                return R.link
            },
            getRightElement: function () {
                if (R.image === "") {
                    return null
                } else {
                    var S = $("<div>", {
                        "class": "nike-cq-social-feed-community-content-right"
                    });
                    S.append(D(R.image, R.link));
                    return S
                }
            }
        }
    };
    return {
        getFeedItem: function (R) {
            var R = $(R);
            var S = R.data();
            switch (S.network) {
                case "facebook":
                    return J(S);
                case "twitter":
                    return F(S);
                case "youtube":
                    return H(S);
                case "brightcove":
                    return L(S);
                case "nikecontent":
                    return A(S);
                case "weibo":
                    return G(S);
                case "qq":
                    return P(S);
                case "mixi":
                    return B(S)
            }
        },
        createLinkElement: E
    }
})();
nike.cq.NikeCom.SocialFeed = {
    el: null,
    button: null,
    buttonShown: true,
    isOpen: false,
    mask: null,
    elementDivs: null,
    totalElements: 24,
    visibleElements: 24,
    closedHeight: 480,
    maxHeight: 960,
    cellSize: 240,
    rows: 4,
    moreText: "More",
    lessText: "Less",
    speed: 400,
    delay: 100,
    fadeSpeed: 400,
    indexProperty: "communityIndex",
    currentSizeClass: "",
    resizeWindowId: null,
    resizeWindowDelay: 150,
    init: function (A) {
        if (!A) {
            return
        }
        this.el = $(A);
        if (this.el.length < 1) {
            return
        }
        var B = this;
        this.elementDivs = this.el.find(".nike-cq-social-feed-community-component-item");
        if (this.elementDivs.length == 0) {
            this.el.parents("section.nike-cq-social-feed").remove();
            return
        }
        this.elementDivs.each(function (D, E) {
            $(E).data(B.indexProperty, D)
        });

        function C() {
            if (document.readyState === "complete") {
                B.elementDivs.find(".nike-cq-social-feed-community-content-text").each(function () {
                    nike.cq.Utils.Ellipsis(this, true);
                    $(this).css("height", "auto")
                })
            } else {
                setTimeout(C, 500)
            }
        }
        setTimeout(C, 100);
        this.el.delegate(".nike-cq-social-feed-community-component-item", {
            click: function (D) {
                nike.cq.NikeCom.SocialFeed.showModal(this);
                D.preventDefault()
            }
        });
        this.totalElements = this.elementDivs.length;
        this.processNikeIdCapitalization();
        this.calculateVisibleElements();
        this.addButton();
        this.addMask();
        this.initEvents();
        this.showHideMoreButton();
        this.createModalCarousel()
    },
    processNikeIdCapitalization: function () {
        var A = this;
        this.elementDivs.find(".nike-cq-social-feed-community-content-title").each(function (B, C) {
            var D = $(C).html();
            $(C).html(A.replaceNikeId(D))
        })
    },
    replaceNikeId: function (A) {
        return A.replace(/nikeid/i, "NIKE<span>i</span>D")
    },
    initEvents: function () {
        var A = this;
        this.button.click(function (B) {
            !A.isOpen ? A.openCommunity() : A.closeCommunity();
            B.preventDefault()
        });
        $(window).resize(function () {
            clearTimeout(A.resizeWindowId);
            A.resizeWindowId = setTimeout(A.resizeWindow, A.resizeWindowDelay)
        });
        A.resizeWindow()
    },
    resizeWindow: function () {
        var D = nike.cq.NikeCom.SocialFeed;
        if (!window.matchMedia) {
            var C = $(window).width();
            var B;
            if (C > 1440) {
                B = 1440
            } else {
                if (C > 1200) {
                    B = 1200
                } else {
                    if (C > 960) {
                        B = 960
                    } else {
                        B = 720
                    }
                }
            }
            D.el.width(B)
        }
        var F = D.el.width(),
            E = Math.ceil(D.totalElements / D.getHorizontalCellCount(F)),
            A = E * D.cellSize;
        A = A < D.maxHeight ? A : D.maxHeight;
        D.el.height(A);
        if (D.isOpen || A < D.closedHeight) {
            D.mask.css("height", A + "px")
        }
        D.calculateVisibleElements();
        D.showHideMoreButton();
        D.resizeMask()
    },
    calculateVisibleElements: function () {
        var A = this.getHorizontalCellCount(this.el.width()) * this.rows;
        this.visibleElements = (this.totalElements < A ? this.totalElements : A)
    },
    getHorizontalCellCount: function (A) {
        return Math.max(3, Math.floor(Math.min(1440, A) / this.cellSize))
    },
    addButton: function () {
        this.el.after('<div class="nike-cq-social-feed-button nike-cq-cta-component nike-cq-cta-text-color-666666 nike-cq-cta-text-size-15 nike-cq-cta-style-curved nike-cq-cta-width-110 nike-cq-cta-height-40 nike-cq-cta-color-dddddd nike-cq-cta-alignment-textlefticonfarright nike-cq-cta-icon-arrowdarkgraydown"><a href="#"><span>' + this.moreText + "</span></a></div>");
        this.button = this.el.siblings(".nike-cq-social-feed-button").children("a")
    },
    addMask: function () {
        var E = this,
            D = $(window).width(),
            F = Math.ceil(this.totalElements / this.getHorizontalCellCount(D)),
            A = F * E.cellSize;
        A = A < E.maxHeight ? A : E.maxHeight;
        this.el.height(A);
        var C = (A < this.closedHeight) ? A : this.closedHeight;
        var B = $("<div>", {
            "class": "nike-cq-community-mask"
        });
        B.height(C);
        this.el.wrapAll(B);
        this.mask = this.el.parent()
    },
    resizeMask: function () {
        var A = this.el.height();
        if (!this.isOpen && A <= this.closedHeight && this.mask.height() < A) {
            if (Modernizr.csstransitions) {
                this.mask.height(A)
            } else {
                this.mask.animate({
                    height: A
                }, this.speed)
            }
        }
    },
    openCommunity: function () {
        var B = this,
            A = this.el.height();
        this.button.addClass("loading");
        if (Modernizr.csstransitions) {
            this.mask.height(A);
            B.button.removeClass("loading");
            B.button.find("span").text(B.lessText);
            B.button.parent().removeClass("nike-cq-cta-icon-arrowdarkgraydown").addClass("nike-cq-cta-icon-arrowdarkgrayup")
        } else {
            this.mask.stop().delay(this.delay).animate({
                height: A + "px"
            }, this.speed, function () {
                B.button.removeClass("loading");
                B.button.find("span").text(B.lessText);
                B.button.parent().removeClass("nike-cq-cta-icon-arrowdarkgraydown").addClass("nike-cq-cta-icon-arrowdarkgrayup")
            })
        }
        this.isOpen = true
    },
    closeCommunity: function () {
        var B = this,
            A = (B.el.height() < B.closedHeight) ? B.el.height() : B.closedHeight;
        this.button.addClass("loading");
        if (Modernizr.csstransitions) {
            this.mask.height(A);
            B.button.removeClass("loading");
            B.button.find("span").text(B.moreText);
            B.button.parent().removeClass("nike-cq-cta-icon-arrowdarkgrayup").addClass("nike-cq-cta-icon-arrowdarkgraydown")
        } else {
            this.mask.stop().delay(this.delay).animate({
                height: A
            }, this.speed, function () {
                B.button.removeClass("loading");
                B.button.find("span").text(B.moreText);
                B.button.parent().removeClass("nike-cq-cta-icon-arrowdarkgrayup").addClass("nike-cq-cta-icon-arrowdarkgraydown")
            })
        }
        this.isOpen = false
    },
    showMoreButton: function () {
        this.button.parent().fadeIn(this.fadeSpeed);
        this.buttonShown = true
    },
    hideMoreButton: function () {
        this.button.parent().fadeOut(this.fadeSpeed);
        this.buttonShown = false
    },
    showHideMoreButton: function () {
        var A = this;
        if (!A.buttonShown && A.el.height() > A.closedHeight) {
            A.showMoreButton()
        } else {
            if (A.buttonShown && A.el.height() <= A.closedHeight) {
                A.closeCommunity();
                A.hideMoreButton()
            }
        }
    },
    createModalCarousel: function () {
        var B = this;
        var A = {
            dialogAppendSelector: "body",
            backgroundClass: "nike-cq-community-modal-background",
            dialogClass: "nike-cq-community-modal-dialog",
            arrowClass: "nike-cq-community-modal-arrow",
            leftArrowClass: "nike-cq-community-modal-left",
            rightArrowClass: "nike-cq-community-modal-right",
            closeClass: "nike-cq-community-modal-close"
        };
        this.modal = nike.cq.UI.ModalCarousel(A);
        this.modal.showModal(false);
        this.modal.getLeftArrow().click(function (E) {
            var C = B.modal.getDialog().data(B.indexProperty);
            var D = B.elementDivs.get(C - 1);
            B.loadModalData(D)
        });
        this.modal.getRightArrow().click(function (E) {
            var C = B.modal.getDialog().data(B.indexProperty);
            var D = B.elementDivs.get(C + 1);
            B.loadModalData(D)
        });
        this.modal.getCloseButton().click(function () {
            B.handleCleanup()
        })
    },
    handleCleanup: function () {
        if (this.currentData && jQuery.isFunction(this.currentData.cleanUp)) {
            this.currentData.cleanUp()
        }
    },
    manageControls: function (A) {
        this.modal.showLeftArrow(A > 0 ? true : false);
        this.modal.showRightArrow(A < (this.visibleElements - 1) ? true : false);
        if (!this.isOpen && this.visibleElements >= A && A >= (this.visibleElements / 2)) {
            this.openCommunity()
        }
    },
    loadModalData: function (D) {
        this.handleCleanup();
        var D = $(D),
            C = this.modal.getDialog(),
            A = this.modal.getCloseButton(),
            E = nike.cq.NikeCom.SocialFeedReader.getFeedItem(D),
            B = D.data(this.indexProperty);
        this.currentData = E;
        C.data(this.indexProperty, B);
        this.manageControls(B);
        var F = E.getSizeClass();
        C.removeClass(this.currentSizeClass).addClass(F);
        A.removeClass(this.currentSizeClass).addClass(F);
        this.currentSizeClass = F;
        this.appendModalData(C, E);
        C.find(".nike-cq-social-feed-community-content-text").each(function () {
            var H = $(this);
            if (E.getLink) {
                var I = E.getLink();
                if (I) {
                    var G = nike.cq.NikeCom.SocialFeedReader.createLinkElement(I);
                    G.html(H.html());
                    H.empty().append(G)
                }
            }
            nike.cq.Utils.Ellipsis(this, true);
            H.height("auto")
        })
    },
    appendModalData: function (B, C) {
        B.empty();
        B.append(this.createLeftElement(C));
        var A = C.getRightElement();
        if (A) {
            B.append(A)
        }
    },
    replaceNikePlus: function (A) {
        return A.replace(/(nike)\+/i, '$1<span class="nikeplus">+</span>')
    },
    createLeftElement: function (B) {
        var A = $("<div>", {
            "class": "nike-cq-social-feed-community-content-left",
            "data-network": B.getNetwork()
        });
        var D = String(B.getTitle());
        D = this.replaceNikeId(D);
        D = this.replaceNikePlus(D);
        var C = this.replaceNikePlus(String(B.getText()));
        A.html('<div class="nike-cq-social-feed-community-content-title">' + D + '</div><div class="nike-cq-social-feed-community-content-text">' + C + '</div><div class="nike-cq-social-feed-community-network-icon"></div>');
        return A
    },
    showModal: function (A) {
        this.modal.showModal(true);
        this.loadModalData(A)
    },
    hideModal: function () {
        this.modal.showModal(false)
    }
};
$(function () {
    nike.cq.Content.i18n.get(["FollowBannerButtonTextLess", "FollowBannerButtonTextMore"], function (A) {
        nike.cq.NikeCom.SocialFeed.lessText = A[0];
        nike.cq.NikeCom.SocialFeed.moreText = A[1];
        if ($("body").data("cmsMode") != "EDIT") {
            $(".nike-cq-social-feed-community-component").each(function (B, C) {
                nike.cq.NikeCom.SocialFeed.init(C)
            })
        }
    })
});
var nike = nike || {};
nike.cq = nike.cq || {};
nike.cq.NikeCom = nike.cq.NikeCom || {};
nike.cq.NikeCom.FollowUs = nike.cq.NikeCom.FollowUs || {};
nike.cq.NikeCom.FollowUs = (function () {
    var D = function () {
        var F = nike.cq.NikeCom.FollowUs;
        F.container.append('<div class="nike-cq-follow-us-button nike-cq-cta-component nike-cq-cta-text-color-666666 nike-cq-cta-text-size-15 nike-cq-cta-style-curved nike-cq-cta-width-110 nike-cq-cta-height-40 nike-cq-cta-color-dddddd nike-cq-cta-alignment-textlefticonfarright nike-cq-cta-icon-arrowdarkgraydown"><a href="#"><span>' + F.moreText + "</span></a></div>");
        F.button = F.container.find(".nike-cq-follow-us-button a");
        F.button.parent().hide()
    };
    var C = function () {
        var F = nike.cq.NikeCom.FollowUs;
        F.list.css({
            overflow: "visible",
            height: "auto"
        });
        F.mask = F.container.find(".nike-cq-follow-us-mask")
    };
    var B = function () {
        var F = nike.cq.NikeCom.FollowUs;
        F.button.click(function (G) {
            G.preventDefault();
            if (F.state === 0) {
                F.showRows(F.delay, F.speed)
            } else {
                F.hideRows(F.delay, F.speed)
            }
        });
        $(window).resize(function () {
            clearTimeout(F.resizeThrottle);
            F.resizeThrottle = setTimeout(A, F.resizeThrottleDelay)
        })
    };
    var A = function () {
        var F = nike.cq.NikeCom.FollowUs;
        F.openHeight = F.list.height();
        if (F.moving !== true && F.state === 1 && F.mask.height() > F.list.height()) {
            F.showRows(0, F.speed / 2)
        }
        if (F.moving !== true && F.state === 1 && F.mask.height() < F.list.height()) {
            F.showRows(0, F.speed / 2)
        }
        F.showOrHideButton()
    };
    var E = {
        container: null,
        list: null,
        mask: null,
        button: null,
        state: 0,
        delay: 500,
        speed: 600,
        fadeSpeed: 500,
        closedHeight: 240,
        openHeight: null,
        moving: false,
        moreText: "More",
        lessText: "Less",
        resizeThrottle: null,
        resizeThrottleDelay: 100,
        minItems: 4,
        init: function () {
            var F = nike.cq.NikeCom.FollowUs;
            F.container = $(F.container);
            F.list = $(F.list);
            F.list.contents().filter(function () {
                return this.nodeType === 3
            }).remove();
            F.openHeight = F.list.height();
            if (F.list.children().length > F.minItems) {
                C();
                D();
                B()
            }
        },
        showRows: function (F, G) {
            var H = nike.cq.NikeCom.FollowUs;
            H.button.addClass("loading");
            H.moving = true;
            H.mask.stop().delay(F).animate({
                height: H.openHeight
            }, G / 2, function () {
                H.state = 1;
                H.moving = false;
                H.resetButton("less");
                H.showOrHideButton()
            })
        },
        hideRows: function (F, G) {
            var H = nike.cq.NikeCom.FollowUs;
            H.button.addClass("loading");
            H.moving = true;
            H.mask.stop().delay(F).animate({
                height: H.closedHeight
            }, G / 2, function () {
                H.state = 0;
                H.moving = false;
                H.resetButton("more");
                H.showOrHideButton()
            })
        },
        showOrHideButton: function () {
            var F = nike.cq.NikeCom.FollowUs;
            if (F.moving !== true && F.state === 0 && F.list.height() > F.closedHeight) {
                F.button.parent().fadeIn(F.fadeSpeed)
            }
            if (F.moving !== true && F.state === 0 && F.list.height() == F.closedHeight) {
                F.button.parent().fadeOut(F.fadeSpeed)
            }
            if (F.moving !== true && F.state === 1 && F.list.height() > F.closedHeight) {
                F.button.parent().fadeIn(F.fadeSpeed)
            }
            if (F.moving !== true && F.state === 1 && F.list.height() == F.closedHeight) {
                F.button.parent().fadeOut(F.fadeSpeed, function () {
                    F.state = 0;
                    F.resetButton("more")
                })
            }
        },
        resetButton: function (F) {
            var G = nike.cq.NikeCom.FollowUs;
            switch (F) {
                case "more":
                    G.button.removeClass("loading").removeClass("open");
                    G.button.parent().removeClass("nike-cq-cta-icon-arrowdarkgrayup").addClass("nike-cq-cta-icon-arrowdarkgraydown");
                    G.button.find("span").text(G.moreText);
                    break;
                case "less":
                    G.button.removeClass("loading").addClass("open");
                    G.button.parent().removeClass("nike-cq-cta-icon-arrowdarkgraydown").addClass("nike-cq-cta-icon-arrowdarkgrayup");
                    G.button.find("span").text(G.lessText);
                    break;
                default:
                    break
            }
        }
    };
    return E
})();
$(function () {
    if ($(".nike-cq-follow-us").length) {
        nike.cq.Content.i18n.get(["FollowBannerButtonTextLess", "FollowBannerButtonTextMore"], function (A) {
            var B = nike.cq.NikeCom.FollowUs;
            B.lessText = A[0];
            B.moreText = A[1];
            B.closedHeight = 240;
            B.delay = 100;
            B.speed = 1000;
            B.container = ".nike-cq-follow-us .nike-cq-follow-component";
            B.list = ".nike-cq-follow-us ul.nike-cq-follow-pages";
            B.init()
        });
        $(window).load(function () {
            $(window).resize()
        })
    }
});
$(document).ready(function () {
    var C = C || $("body");
    if ($(".nike-cq-active-page-title").length > 0 && $(".nike-cq-active-page-title-optional").length == 0 && C.data("cmsMode") !== "EDIT") {
        $(".nike-cq-content").addClass("has-active-page-title");
        $(".nike-cq-page-container-inner").addClass("cq-has-active-page-title")
    }
    var A = navigator.userAgent.toLowerCase();
    var B = A.match(/(iphone|ipod|ipad)/);
    if (B) {
        $(".nike-cq-active-page-title").css({
            "background-color": "#444",
            height: "60px",
            top: "50px",
            width: "100%",
            "z-index": "800",
            "min-width": "768px",
            position: "static"
        });
        if ($(".gnav").length > 0 && $(".nike-cq-page-module.nike-cq-active-page-title").length > 0) {
            $(".nike-cq-content").removeClass("has-active-page-title");
            $(".nike-cq-active-page-title .nike-cq-cta-component nav > ul").css({
                position: "relative",
                top: "-15px"
            })
        }
    }
});
var nike = nike || {};
nike.cq = nike.cq || {};
nike.cq.NikeCom = nike.cq.NikeCom || {};
nike.cq.NikeCom.StoryPageHero = (function () {
    var B = function () {
        var D = $(".nike-cq-story-hero-video .video-thumbnail");
        if (D.length > 0) {
            D.bind("click", function () {
                var F = $(this);
                var I = 912;
                var E = 513;
                var H = "nike-cq-overlay-video-player-large";
                if ($(window).width() < 960) {
                    var I = 704;
                    var E = 396;
                    var H = "nike-cq-overlay-video-player-small"
                }
                var G = new nike.cq.UI.Overlay({
                    cssClass: H,
                    onOpen: function () {
                        $(F).clone().appendTo(".nike-cq-overlay-content-element").attr("id", "nike-cq-overlay-video-player");
                        var J = $("#nike-cq-overlay-video-player");
                        J.attr("data-width", I);
                        J.attr("data-height", E);
                        nike.cq.NikeCom.StoryPageHero.overlayVideo = new nike.cq.UI.Component.VideoPlayer(J)
                    },
                    onBeforeClose: function () {
                        nike.cq.NikeCom.StoryPageHero.overlayVideo.remove();
                        this.close()
                    }
                })
            })
        }
    };
    var A = function () {
        $(".nike-cq-story-hero-slideshow-component").each(function () {
            nike.cq.NikeCom.StoryPageHero.slideshow = new nike.cq.UI.Component.Slideshow(this)
        });
        $(".nike-cq-story-hero-slideshow-slide-description").css({
            opacity: "0.0",
            display: "block"
        });
        var F = false;
        var E = $("html").hasClass("ie8") ? "0.7" : "1.0";
        $(".nike-cq-story-hero-slideshow-component").bind("mouseenter", function () {
            F = true;
            $(this).find(".nike-cq-story-hero-slideshow-slide-selected .nike-cq-story-hero-slideshow-slide-description").stop().animate({
                opacity: E
            }, 1000)
        }).bind("mouseleave", function () {
            F = false;
            $(this).find(".nike-cq-story-hero-slideshow-slide-selected .nike-cq-story-hero-slideshow-slide-description").stop().animate({
                opacity: "0.0"
            }, 1000)
        }).bind("slidestart", function () {
            $(this).find(".nike-cq-story-hero-slideshow-slide-selected .nike-cq-story-hero-slideshow-slide-description").stop().animate({
                opacity: "0.0"
            }, 1000)
        }).bind("slideend", function () {
            if (F) {
                $(this).find(".nike-cq-story-hero-slideshow-slide-selected .nike-cq-story-hero-slideshow-slide-description").stop().animate({
                    opacity: E
                }, 1000)
            }
        }).delegate(".nike-cq-story-hero-slideshow-slide", "click", function () {
            $this = $(this);
            if (!$this.hasClass("nike-cq-story-hero-slideshow-slide-selected")) {
                if ($this.offset().left < $(document).width() / 2) {
                    nike.cq.NikeCom.StoryPageHero.slideshow.previous()
                } else {
                    nike.cq.NikeCom.StoryPageHero.slideshow.next()
                }
            }
        });
        var G = 0;
        if (window.matchMedia) {
            if (typeof nike.cq.NikeCom.StoryPageHero !== "undefined") {
                var D = window.matchMedia(" (max-width: 960px)");
                D.addListener(function () {
                    G = nike.cq.NikeCom.StoryPageHero.slideshow.getCurrentSlideIndex();
                    nike.cq.NikeCom.StoryPageHero.slideshow.setSlideWidth();
                    nike.cq.NikeCom.StoryPageHero.slideshow.slideTo(G)
                })
            }
        } else {
            $(window).resize(function () {
                if (typeof nike.cq.NikeCom.StoryPageHero.slideshow !== "undefined") {
                    G = nike.cq.NikeCom.StoryPageHero.slideshow.getCurrentSlideIndex();
                    nike.cq.NikeCom.StoryPageHero.slideshow.setSlideWidth();
                    nike.cq.NikeCom.StoryPageHero.slideshow.slideTo(G)
                }
            })
        }
    };
    var C = {
        videosInit: function () {
            B()
        },
        slideshowInit: function () {
            A()
        }
    };
    return C
})();
$(function () {
    if ($(".nike-cq-story-hero-video").length) {
        nike.cq.NikeCom.StoryPageHero.videosInit()
    }
    if ($(".nike-cq-story-hero .nike-cq-story-hero-slideshow-component").length) {
        nike.cq.NikeCom.StoryPageHero.slideshowInit()
    }
});
var nike = nike || {};
nike.cq = nike.cq || {};
nike.cq.NikeCom = nike.cq.NikeCom || {};
nike.cq.NikeCom.storypagebody = (function () {
    var A = function () {
        var C = $(".nike-cq-story-body-video .video-thumbnail");
        if (C.length > 0) {
            C.bind("click", function () {
                var E = $(this);
                var H = 912;
                var D = 513;
                var G = "nike-cq-overlay-video-player-large";
                if ($(window).width() < 960) {
                    var H = 704;
                    var D = 396;
                    var G = "nike-cq-overlay-video-player-small"
                }
                var F = new nike.cq.UI.Overlay({
                    cssClass: G,
                    onOpen: function () {
                        $(E).clone().appendTo(".nike-cq-overlay-content-element").attr("id", "nike-cq-overlay-video-player");
                        var I = $("#nike-cq-overlay-video-player");
                        I.attr("data-width", H);
                        I.attr("data-height", D);
                        nike.cq.NikeCom.storypagebody.overlayVideo = new nike.cq.UI.Component.VideoPlayer(I)
                    },
                    onBeforeClose: function () {
                        nike.cq.NikeCom.storypagebody.overlayVideo.remove();
                        this.close()
                    }
                })
            })
        }
    };
    var B = {
        videosInit: function () {
            A()
        }
    };
    return B
})();
$(function () {
    if ($(".nike-cq-story-body-video").length) {
        nike.cq.NikeCom.storypagebody.videosInit()
    }
});
var nike = nike || {};
nike.cq = nike.cq || {};
nike.cq.NikeCom = nike.cq.NikeCom || {};
nike.cq.NikeCom.leftNavigation = (function () {
    var H = $(".nike-cq-left-navigation-component"),
        I = H.find(".nike-cq-nav-title"),
        J = H.find(".nike-cq-left-navigation-nav-links"),
        K = H.find(".nike-cq-nav-section-title"),
        L = H.find(".nike-cq-nav-nav"),
        E = $(".nike-cq-page-section-left-navigation-container").attr("data-nav-config"),
        F = I.outerHeight(true),
        C = K.outerHeight(true),
        B = 400;
    if (typeof E === "undefined") {
        E = 6
    }
    var D = function () {
        I.append('<span class="nike-cq-left-nav-action-main">-</span>');
        K.append('<span class="nike-cq-left-nav-action">-</span>');
        I.wrap('<a href="#" class="nike-cq-nav-title-link"></a>');
        K.wrap('<a href="#" class="nike-cq-nav-section-title-link"></a>');
        H.delegate("a.nike-cq-nav-section-title-link", "click", function (P) {
            P.preventDefault();
            var O = $(this),
                N = O.find("span.nike-cq-left-nav-action"),
                M = O.parents(".nike-cq-nav-section:first");
            if (N.html() == "-") {
                if (typeof M.data("height") == "undefined") {
                    M.data("height", M.height())
                }
                M.stop().animate({
                    height: C + "px"
                }, B, function () {
                    L.data("height", L.height());
                    O.addClass("nike-cq-nav-closed")
                });
                N.html("+")
            } else {
                M.stop().animate({
                    height: M.data("height")
                }, B, function () {
                    M.css("height", "auto");
                    L.data("height", L.height())
                });
                O.removeClass("nike-cq-nav-closed");
                N.html("-")
            }
        });
        H.delegate("a.nike-cq-nav-title-link", "click", function (O) {
            O.preventDefault();
            var N = $(this),
                M = N.find("span.nike-cq-left-nav-action-main");
            if (M.html() == "-") {
                if (typeof L.data("height") == "undefined") {
                    L.data("height", L.height())
                }
                F = I.outerHeight(true);
                L.stop().animate({
                    height: F
                }, B, function () {
                    I.addClass("nike-cq-min-nav");
                    L.addClass("nike-cq-min-nav-section")
                });
                M.html("+")
            } else {
                I.removeClass("nike-cq-min-nav");
                L.removeClass("nike-cq-min-nav-section");
                L.stop().animate({
                    height: L.data("height")
                }, B, function () {
                    L.css("height", "auto")
                });
                M.html("-")
            }
        })
    };
    var A = function (U, S) {
        J.each(function (V) {
            var W = $(this),
                a = W.find("li");
            if (a.length > E) {
                var Y = a.outerHeight(true),
                    Z = Y * (E - 1);
                W.data("height", W.height()).data("minheight", Z);
                var X = U.replace("[title text]", W.attr("data-plural"));
                W.addClass("nike-cq-left-navigation-nav-links-shrunk").height(Z).after('<span class="nike-cq-left-nav-additional-content"><a href="#" data-plural="' + W.attr("data-plural") + '">' + X + "</a></span>")
            }
        });
        var T = $(".nike-cq-left-nav-additional-content");
        if (T.length) {
            H.delegate(".nike-cq-left-nav-additional-content a", "click", function (X) {
                X.preventDefault();
                var W = $(this),
                    V = W.parent().prev(".nike-cq-left-navigation-nav-links");
                if (W.hasClass("nike-cq-left-nav-section-expanded")) {
                    W.html(U.replace("[title text]", W.attr("data-plural")));
                    V.animate({
                        height: V.data("minheight")
                    }, B, function () {
                        var Y = W.parents(".nike-cq-nav-section:first");
                        Y.data("height", Y.height());
                        L.data("height", L.height())
                    });
                    W.removeClass("nike-cq-left-nav-section-expanded")
                } else {
                    W.html(S.replace("[title text]", W.attr("data-plural")));
                    V.animate({
                        height: V.data("height")
                    }, B, function () {
                        var Y = W.parents(".nike-cq-nav-section:first");
                        Y.data("height", Y.height());
                        L.data("height", L.height())
                    });
                    W.addClass("nike-cq-left-nav-section-expanded")
                }
            })
        }
        var M = 120;
        var O = $(".nike-cq-active-page-title-optional,.nike-cq-notification-reference-component").length;
        if (O) {
            M = M - (O * 60)
        }
        var N = $("section.nike-cq-left-navigation").position().top - M;
        var R = function () {
            if ($(document).width() <= 1472) {
                $("a.nike-cq-nav-section-title-link:not(a.nike-cq-nav-section-title-link:first)").click()
            }
            if ($(document).width() <= 1009) {
                $("a.nike-cq-nav-title-link").click()
            }
            if (typeof P != "undefined") {
                window.clearInterval(P)
            }
            $("section.nike-cq-left-navigation").css("top", N).animate({
                opacity: 1
            }, 1000, function () {
                $(this).addClass("nike-cq-visible-nav")
            })
        };
        var Q = function () {
            if (MonoTypeWebFonts.cleanupExecuted) {
                R()
            }
        };
        if (typeof MonoTypeWebFonts == "undefined") {
            R()
        } else {
            var P = window.setInterval(Q, 1000)
        }
    };
    var G = {
        init: function () {
            D();
            nike.cq.Content.i18n.get({
                more: "LeftNavMore",
                less: "LeftNavLess"
            }, function (M) {
                A(M.more, M.less)
            })
        },
        initLeftNavMod: function () {
            if ($(".left-bar").length) {
                $(".nike-cq-tesla-xml").addClass("nike-cq-mod-left-nav tesla-mod-left-nav")
            }
        }
    };
    return G
})();
$(function () {
    nike.cq.NikeCom.leftNavigation.initLeftNavMod();
    if ($(".nike-cq-left-navigation").length) {
        nike.cq.NikeCom.leftNavigation.init()
    }
});
nike.cq.NikeCom.TeamSelector = (function () {
    var A = function (F) {
        var G = $(".nike-cq-team-selector-tooltip");
        var E = 200;
        if (G.length < 1) {
            G = $('<div class="nike-cq-team-selector-tooltip"><div class="nike-cq-team-selector-tooltip-content"></div><div class="nike-cq-team-selector-tooltip-content-arrow"></div></div>').appendTo("body").hide()
        }
        var H;

        function D(L, I) {
            G.find(".nike-cq-team-selector-tooltip-content").html(L);
            var J = G.width();
            var K = I.offset();
            G.css({
                left: K.left,
                top: K.top,
                "margin-left": parseInt(-(J - I.width()) / 2) + "px"
            });
            G.fadeIn("fast")
        }
        function C() {
            G.hide()
        }
        F.delegate(".nike-cq-team-selector-link-item", {
            mouseenter: function () {
                var I = $(this),
                    J = I.find("img").attr("alt");
                H = setTimeout(function () {
                    D(J, I)
                }, E)
            },
            mouseleave: function (I) {
                if (H) {
                    clearTimeout(H);
                    H = null
                }
                C()
            }
        })
    };
    var B = function () {
        var F = F || $("body");
        var E = 400;
        var C = "initialized";
        var D = nike.cq.Utils.detectLeftNav("both") ? 1229 : 960;
        if (F.data("cmsMode") !== "EDIT") {
            $(".nike-cq-team-selector-module").each(function () {
                var H = $(this),
                    G = H.find(".nike-cq-section-team-selector").data("open"),
                    L = H.find(".nike-cq-team-selector-reference"),
                    P = H.find(".nike-cq-team-selector-component"),
                    M = H.find(".nike-cq-team-selector-subtitle-line-1"),
                    I = H.find(".nike-cq-team-selector-tab"),
                    K = H.data(C);
                if (K) {
                    return
                }
                if (!G) {
                    L.hide()
                }
                if (P) {
                    var J = {
                        tabContainer: I.parent(".nike-cq-team-selector-tab-container")
                    };
                    var O = new nike.cq.UI.Component.LiquidCarousel(P, J);
                    A(O.resourceEl)
                }
                I.click(function () {
                    L.slideToggle(E);
                    M.toggleClass("open")
                });
                var Q = H.closest(".nike-cq-p1").find(".nike-cq-p1-reference-component");
                H.closest(".nike-cq-container").css("padding-top", "0px");

                function N() {
                    if ($(window).width() <= D) {
                        Q.removeClass("nike-cq-team-selector-p1-module-fixed-height");
                        Q.addClass("nike-cq-team-selector-p1-module-fixed-height-short")
                    } else {
                        Q.addClass("nike-cq-team-selector-p1-module-fixed-height");
                        Q.removeClass("nike-cq-team-selector-p1-module-fixed-height-short")
                    }
                }
                N();
                var R = null;
                $(window).resize(function () {
                    if (R) {
                        clearTimeout(R)
                    }
                    R = setTimeout(N(), 50)
                });
                H.data(C, true)
            })
        }
    };
    return {
        init: B
    }
})();
$(document).ready(nike.cq.NikeCom.TeamSelector.init);
nike.cq.NikeCom.Iframe = (function () {
    function A() {
        var D = $("#iframe-container");
        var E = D.contents();
        var C = E.find("div.mask");
        if (E.length > 0 && E.get(0).readyState === "complete") {
            if (C.length > 0) {
                frameHeight = C.height();
                D.height(frameHeight)
            } else {
                frameHeight = E.height();
                D.height(frameHeight)
            }
        }
    }
    function B() {
        var C = $("#iframe-container");
        if (C.length == 0) {
            return
        }
        var D = null;
        $(window).resize(function () {
            if (D) {
                clearTimeout(D)
            }
            D = setTimeout(A, 100)
        })
    }
    return {
        init: B
    }
})();
$(function () {
    nike.cq.NikeCom.Iframe.init()
});
var Nike = Nike || {};
nike.cq = nike.cq || {};
nike.cq.NikeCom = nike.cq.NikeCom || {};
nike.cq.NikeCom.home = (function () {
    var B = function () {
        nike.cq.Content.i18n.get("FollowText", function (H) {
            var E = $(".nike-cq-follow-page-1 .nike-cq-follow-content .nike-cq-follow-options").clone(true);
            var F = $(".nike-cq-follow-page-1 .nike-cq-follow-title").clone();
            var D;
            if (H != "") {
                D = H.replace(/\[.*\]/i, F.text());
                F.text(D)
            }
            var G = $("<div/>", {
                "class": "nike-cq-floating-follow"
            });
            var C = $(G).append(F).append(E);
            $(".nike-cq-p1").append(C)
        });
        $(".nike-cq-floating-follow").find('[style*="hidden"]').css("visibility", "visible")
    };
    var A = {
        init: function () {
            B()
        }
    };
    return A
})();
$(function () {
    if ($(".nike-cq-home-page").length) {
        nike.cq.NikeCom.home.init()
    }
});
var Nike = Nike || {};
nike.cq = nike.cq || {};
nike.cq.NikeCom = nike.cq.NikeCom || {};
nike.cq.NikeCom.oneNike3P2 = (function () {
    var A = function () {
        nike.cq.Content.i18n.get("FollowText", function (H) {
            var E = $(".nike-cq-follow-page-1 .nike-cq-follow-content .nike-cq-follow-options").clone(true);
            var F = $(".nike-cq-follow-page-1 .nike-cq-follow-title").clone();
            var D;
            if (H != "") {
                D = H.replace(/\[.*\]/i, F.text());
                F.text(D)
            }
            var G = $("<div/>", {
                "class": "nike-cq-floating-follow"
            });
            var C = $(G).append(F).append(E);
            $(".nike-cq-p1").append(C)
        });
        $(".nike-cq-floating-follow").find('[style*="hidden"]').css("visibility", "visible")
    };
    var B = {
        init: function () {
            A()
        }
    };
    return B
})();
$(function () {
    if ($(".nike-cq-one-nike-3p2-page").length) {
        nike.cq.NikeCom.oneNike3P2.init()
    }
});
var Nike = Nike || {};
nike.cq = nike.cq || {};
nike.cq.NikeCom = nike.cq.NikeCom || {};
nike.cq.NikeCom.shopPage = (function () {
    var A = function () {
        $(".nike-cq-container-component > section").not(".nike-cq-left-navigation").last().addClass("last-child")
    };
    var B = {
        init: function () {
            A()
        }
    };
    return B
})();
$(function () {
    if ($(".nike-cq-shop-page").length) {
        nike.cq.NikeCom.shopPage.init()
    }
});